<?php

class DataObject
{
    function  __construct($array)
    {
        foreach ($array as $key => $value)
        {
            $key = strtolower($key);
            $this->$key = $value;
        }
    }

    function get($fieldName)
    {
        $fieldName = strtolower($fieldName);
        if(property_exists($this, $fieldName))
            return $this->$fieldName;
        else
            exit("Property $fieldName does not exist !");
    }
}


?>
